#include "SerialPort.h"
#include "termios.h"
namespace MC500 {
    
class LinuxSerialPort : public SerialPort {
    public:
    LinuxSerialPort(const std::string &devName) : SerialPort(), devName_(devName), fd_(-1){};
    virtual ~LinuxSerialPort();

    virtual ErrorCode Init(uint32_t speed);

    //发送数据
    virtual ErrorCode Send(const uint8_t *data, uint16_t len);

    //接受数据
    virtual ErrorCode Read(uint8_t *data, uint16_t buffSize, uint16_t &readCount);

    private:
    speed_t GetUARTSpeedByValue(uint32_t baudrate);
    std::string devName_;
    int fd_;
};

}


